package megrez.mail.sender.web.vo;

import java.util.Date;

import org.springframework.beans.BeanUtils;

import lombok.Data;
import megrez.mail.sender.domain.MailContentType;
import megrez.mail.sender.domain.TemplateConfig;

/**
 * 模板配置VO
 * 
 * @author Lucky Yang
 * @since 2.6.9
 */
@Data
public class TemplateConfigVO {
    private String id;
    private Integer version;
    private String createdBy;
    private Date createdDate;
    private String lastModifiedBy;
    private Date lastModifiedDate;

    private MailContentType type;    
    private String code;
    private String remark;
    private Boolean enabled;

    public TemplateConfigVO() {
    }

    
    public static TemplateConfigVO of(TemplateConfig config) {
        if (config == null) {
            return null;
        }
        TemplateConfigVO rslt = new TemplateConfigVO();
        BeanUtils.copyProperties(config, rslt);
        return rslt;
    }

    @Override
    public boolean equals(Object o) {
        return super.equals(o);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }


    public TemplateConfigVO(MailContentType type, String code, String remark, Boolean enabled) {
        this.type = type;
        this.code = code;
        this.remark = remark;
        this.enabled = enabled;
    } 
}
